

class Person {
    public String name;//null
    public int age;
    public void eat() {
        System.out.println("吃饭!");
    }
    public void sleep(){
        System.out.println(name+"睡觉!");
    }
}
class WashMachine {
    public String brand; // 品牌
    public String type; // 型号
    public double weight; // 重量
    public double length; // 长
    public double width; // 宽
    public double height; // 高
    public String color; // 颜色
    public void washClothes() { // 洗衣服
        System.out.println("洗衣功能");
    }
    public void dryClothes() { // 脱水
        System.out.println("脱水功能");
    }
    public void setTime() { // 定时
        System.out.println("定时功能");
    }
}
class Phone {
    public String brand; // 品牌
    public String type; // 型号
    public double weight; // 重量
    public double length; // 长
    public double width; // 宽
    public double height; // 高
    public String color; // 颜色
    public String screen;//屏幕
    //......
    public void movie() {
        System.out.println("看电影");
    }
    public void call() {
        System.out.println("打电话");
    }
}

public class Test2 {
    public static void main1(String[] args) {
        //通过关键字 new 实例化一个Phone对象
        Phone phone = new Phone();
        Person person = new Person();
        WashMachine washMachine = new WashMachine();
    }

    public static void main(String[] args) {
        //一个类可以实例化多个对象，通过关键字new
        Person person1 = new Person();
        person1.age = 10;
        person1.name = "张三";
        person1.sleep();
        System.out.println(person1.name+" "+person1.age);

        Person person2 = new Person();
        person2.age = 18;
        person2.name = "李四";
        person2.sleep();
        System.out.println(person2.name+" "+person2.age);
    }
}
